package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetBuyerOrdersListBean;
import com.ymatou.query.trading.api.service.GetBuyerOrdersListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.common.enums.AppViewOrderStateEnum;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.constant.ECode;

/**
 * 获取买家订单列表 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetBuyerOrdersList {

	private static GetBuyerOrdersListBean getbuyerorderslistbean;
	private static GetBuyerOrdersListCall getbuyerorderslistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取买家订单列表");
	}

	@Before
	public void caseUp() {

		getbuyerorderslistbean = new GetBuyerOrdersListBean();
		getbuyerorderslistcall = new GetBuyerOrdersListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getbuyerorderslistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetBuyerOrdersList_001() {
		Logger.start(true,"获取买家订单列表成功");
		try {
			// 参数
			int BuyerId = Integer.valueOf(EnvSetup.getData("BuyUserId"));

			getbuyerorderslistbean.setAppViewOrderState(AppViewOrderStateEnum.All);
			// int BuyerId = 1113;
			getbuyerorderslistbean.setBuyerId(BuyerId);
			int OrderId = 500384768;
			getbuyerorderslistbean.setLastOrderId(OrderId);
			int OrderNum = 13;
			getbuyerorderslistbean.setOrderNum(OrderNum);
			ArrayList<Integer> list = new ArrayList<Integer>();
			getbuyerorderslistbean.setOrderStatusList(list);
			// 发送请求
			getbuyerorderslistcall.setData(getbuyerorderslistbean);
			getbuyerorderslistcall.callService();
			Logger.comment("getbuyerorderslistcall send:" + getbuyerorderslistcall.getEntityString());
			Logger.comment("getbuyerorderslistcall response:" + getbuyerorderslistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerorderslistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerorderslistcall.getMsg(), "验证Msg");
			Logger.verifyEquals(OrderNum, getbuyerorderslistcall.getOrdersNum(), "验证查询结果数量");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetBuyerOrdersList_002() {
		Logger.start(true,"获取买家订单列表成功");
		try {
			// 参数
			getbuyerorderslistbean.setAppViewOrderState(AppViewOrderStateEnum.PendingPay);
			int BuyerId = 1113;
			getbuyerorderslistbean.setBuyerId(BuyerId);
			int OrderId = 500384768;
			getbuyerorderslistbean.setLastOrderId(OrderId);
			int OrderNum = 12;
			getbuyerorderslistbean.setOrderNum(OrderNum);
			ArrayList<Integer> list = new ArrayList<Integer>();
			getbuyerorderslistbean.setOrderStatusList(list);
			// 发送请求
			getbuyerorderslistcall.setData(getbuyerorderslistbean);
			getbuyerorderslistcall.callService();
			Logger.comment("getbuyerorderslistcall send:" + getbuyerorderslistcall.getEntityString());
			Logger.comment("getbuyerorderslistcall response:" + getbuyerorderslistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerorderslistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerorderslistcall.getMsg(), "验证Msg");
			Logger.verifyEquals(OrderNum, getbuyerorderslistcall.getOrdersNum(), "验证查询结果数量");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetBuyerOrdersList_003() {
		Logger.start(true,"获取买家订单列表成功");
		try {
			// 参数
			getbuyerorderslistbean.setAppViewOrderState(AppViewOrderStateEnum.PendingReceive);
			int BuyerId = 1113;
			getbuyerorderslistbean.setBuyerId(BuyerId);
			int OrderId = 500384768;
			getbuyerorderslistbean.setLastOrderId(OrderId);
			int OrderNum = 10;
			getbuyerorderslistbean.setOrderNum(OrderNum);
			ArrayList<Integer> list = new ArrayList<Integer>();
			getbuyerorderslistbean.setOrderStatusList(list);
			// 发送请求
			getbuyerorderslistcall.setData(getbuyerorderslistbean);
			getbuyerorderslistcall.callService();
			Logger.comment("getbuyerorderslistcall send:" + getbuyerorderslistcall.getEntityString());
			Logger.comment("getbuyerorderslistcall response:" + getbuyerorderslistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getbuyerorderslistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getbuyerorderslistcall.getMsg(), "验证Msg");
			Logger.verifyEquals(OrderNum, getbuyerorderslistcall.getOrdersNum(), "验证查询结果数量");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}